#include <cppunit/config/SourcePrefix.h>
#include "QueueTestCase.h"

CPPUNIT_TEST_SUITE_REGISTRATION( QueueTestCase );

void QueueTestCase::testLen()
{
    CPPUNIT_ASSERT_EQUAL(m_my.length(), 10);
}

void QueueTestCase::setUp()
{
    m_my = IntQueue(10);
}

void QueueTestCase::testPush()
{
    bool ret;
    for(int i=0; i<9; i++)
    {
        ret = m_my.push(i);
        CPPUNIT_ASSERT(ret);
    }

    ret = m_my.push(100);
    CPPUNIT_ASSERT_EQUAL(ret, false);
}


void QueueTestCase::testPop()
{
    for(int i=0; i<9; i++)
        m_my.push(i);

    bool ret; 
    int val;
    for(int j=0; j<9; j++)
    {
       ret = m_my.pop(&val);
       CPPUNIT_ASSERT(ret);
       CPPUNIT_ASSERT_EQUAL(val, j);
    }

    ret = m_my.pop(&val);
    CPPUNIT_ASSERT_EQUAL(ret, false);
}



